package com.poitest.service.impl;

import com.poitest.mapper.TPoorMapper;
import com.poitest.mapper.TTitleMapper;
import com.poitest.pojo.TPoor;
import com.poitest.pojo.TPoorExample;
import com.poitest.pojo.TTitle;
import com.poitest.service.PoorService;
import excel.ImportRspInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PoorServiceImpl implements  PoorService {

    @Autowired
    TPoorMapper tPoorMapper;
    @Autowired
    TTitleMapper tTitleMapper;

    @Override
    public boolean addAll(ImportRspInfo<TPoor> list) {
        List<TPoor> data = list.getData();
        data.forEach(d->{
            tPoorMapper.insert(d);
        });
        return true;
    }

    @Override
    public List<TPoor> selectByExample(Object o) {
        return tPoorMapper.selectByExample(null);
    }

    @Override
    public void updateT(int id) {
        TPoor tPoor = tPoorMapper.selectByPrimaryKey(id);
        Integer psize = tPoor.getPsize();
        tPoor.setPsize(psize+1);
        tPoorMapper.updateByPrimaryKeySelective(tPoor);
    }

    @Override
    public List<TPoor> PoorList() {
        return tPoorMapper.selectByExample(null);
    }

    @Override
    public TTitle findOne(Integer id) {
        TTitle tTitle = tTitleMapper.selectByPrimaryKey(id);


        return tTitle;
    }


}
